package com.net.xpay.common.manager.impl.open;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.net.xpay.common.manager.open.OpenApiAppManager;
import com.net.common.annotation.ReadTransactional;
import com.net.common.dao.BasicMapper;
import com.net.xpay.common.dao.open.OpenApiAppMapper;
import com.net.xpay.common.domain.open.OpenApiApp;
import com.net.common.manager.AbstractManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
@ReadTransactional
public class OpenApiAppManagerImpl extends AbstractManager<OpenApiApp> implements OpenApiAppManager {

    @Autowired
    private OpenApiAppMapper mapper;


    @Override
    protected BasicMapper<Long, OpenApiApp> getMapper() {
        return mapper;
    }

    @Override
    public OpenApiApp findByAppkey(String appkey) {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(appkey));
        OpenApiApp condition = new OpenApiApp();
        condition.setAppkey(appkey);
        return getByCondition(condition);
    }
}
